﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;

namespace System.Data.DataSetGenerator
{
    public class RelationCollection : Collection<RelationDescriptor>
    {
        public RelationCollection()
        {

        }


        public RelationDescriptor this[String relationName]
        {
            get
            {
                if (relationName == null)
                    relationName = "";
                foreach (var relation in this)
                {
                    if (relationName.Equals(relation.RelationName))
                        return relation;
                }
                return null;
            }
        }

        public bool Contains(String relationName)
        {
            return this[relationName] != null;
        }
    }
}
